<template>
    <div class="box" @mousedown="mousedown">
        <div class="left">
            <img :src="icon" width="20" height="20"/>
        </div>
        <div class="center">{{title}}</div>
        <div class="right">
            <a-icon @click="close" type="close-circle" class="exit"/>
        </div>
    </div>
</template>

<script>
    export default {
        name: "windowTool",
        props: {
            title: String,
            icon: String,
        },
        methods: {
            mousedown(e) {
                this.$emit("mousedown", e)
            },
            close() {
                this.$emit("close")
            }
        }
    }
</script>

<style scoped>
    .box {
        --tool-height: 20px
    }

    .box {
        line-height: var(--tool-height);
        width: 100%;
        height: var(--tool-height);
        display: flex;
    }

    .left, .right {
        width: 50px;
        height: var(--tool-height);
    }

    .left {
        padding-left: 5px;
        width: 27px;
    }

    .right {
        text-align: right;
        padding-right: 5px;
    }

    .center {
        flex: 1;
        height: var(--tool-height);
        /*margin:10px;!*左右margin不会叠加*!*/
    }

    .exit:hover {
        cursor: pointer;
        color: #de5454;
    }

</style>